package com.yfp.minapp.auth.api;

import cn.hutool.core.date.DateTime;
import com.yfp.common.core.constant.ServiceNameConstants;
import com.yfp.common.core.domain.Response;
import com.yfp.minapp.auth.api.domain.Client;
import com.yfp.minapp.auth.api.domain.ReplenishDTO;
import com.yfp.minapp.auth.api.factory.RemoteClientFallbackFactory;
import io.swagger.v3.oas.annotations.Operation;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

import java.math.BigDecimal;
import java.util.List;
import java.util.Map;

/**
 * Client 服务
 *
 * @author ruoyi
 */
@FeignClient(value = ServiceNameConstants.CLIENT_APP_PAY_SERVICE, fallbackFactory = RemoteClientFallbackFactory.class)
public interface RemoteClientService {

    @GetMapping("/client/pay/admin/weixin/refund")
    @Operation(summary = "微信支付退款", description = "后台订单退款使用")
    Response<Boolean> adminRefund(@RequestParam("orderListId") String orderListId, @RequestParam("amt") BigDecimal amt);

    @GetMapping("/client/pay/admin/balance/refund")
    @Operation(summary = "余额支付退款", description = "后台订单退款使用")
    Response<Boolean> adminBalanceRefund(@RequestParam("orderListId") String orderListId, @RequestParam("amt") BigDecimal amt);

    @GetMapping("/client/pay/weixin/notify/refund/simulate")
    @Operation(summary = "微信支付退款-模拟", description = "后台订单退款使用")
    Response<Boolean> adminRefundNotifyResultSimulate(@RequestParam("orderListId") String orderListId, @RequestParam("amt") BigDecimal amt);


    @GetMapping("/client/list")
    @Operation(summary = "获取用户列表")
    Response<List<Client>> clientList();


    @GetMapping("/job/check/order/expired")
    @Operation(summary = "检查订单是否过期")
    Response<Void> checkAllOrderExpired();

    @PostMapping("/client/machine/computeEstimatedPrice")
    @Operation(summary = "计算套餐价格", description = "套餐列表页面使用")
    Response<Map<String, ReplenishDTO.Marketing>> computeEstimatedPrice(@RequestParam("machineId") String machineId, @RequestBody List<ReplenishDTO> replenishDTOS);

    @GetMapping("/client/wx-info/notify/cooking-status")
    @Operation(summary = "炒制状态通知")
    Response<Void> notifyCookingStatus(@RequestParam("orderId") String orderId, @RequestParam("orderDetailId") String orderDetailId);

    @GetMapping("/client/wx-info/notify/take-food")
    @Operation(summary = "取餐提醒")
    Response<Void> notifyTakeFood(@RequestParam("orderId") String orderId, @RequestParam("orderDetailId") String orderDetailId, @RequestParam("date") DateTime date);

    /**
     * 储值退款
     *
     * @param clientId
     * @return
     */
    @Operation(summary = "储值退款")
    @PostMapping("/client/pay/storedRefund")
    public Response<Boolean> storedRefund(@RequestParam("clientId") String clientId);

    @Operation(summary = "商城订单退款")
    @PostMapping("/client/pay/mallOrderRefund")
    Response<Boolean> mallOrderRefund(@RequestParam("id") Long id);
    @GetMapping("/job/mall/logistics-info")
    @Operation(summary = "商城物流信息")
    Response<Void> updateOrderLogisticsInfoJob();
}
